var db = {
  //员工
  staff: [
    {
      id: 1,
      name: "张三",
      sex: "男",
      //部门
      department: "销售部",
      //职务
      post: "组长",
      phone: 19999999999,
      //密码
      password: 123456,
      //备注
      remarks: "",
      //业绩目标
      achievement: {},
      //邮箱
      e_mail: 888,
      birthday: "2000-01-2",
    },
    {
      id: 2,
      name: "李四",
      sex: "男",
      //部门
      department: "销售一组",
      //职务
      post: "组长",
      phone: 18888888888,
      //密码
      password: 123456,
      //备注
      remarks: "",
      //业绩目标
      achievement: {},
      //邮箱
      e_mail: 888,
      birthday: "2000-01-2",
    },
    {
      id: 3,
      name: "王五",
      sex: "男",
      //部门
      department: "销售二组",
      //职务
      post: "组长",
      phone: 17777777777,
      //密码
      password: 123456,
      //备注
      remarks: "",
      //业绩目标
      achievement: {},
      //邮箱
      e_mail: 888,
      birthday: "2000-01-2",
    },
    {
      id: 4,
      name: "赵六",
      sex: "女",
      //部门
      department: 1,
      //职务
      post: "组员",
      phone: 16666666666,
      //密码
      password: 123456,
      //备注
      remarks: "",
      //业绩目标
      achievement: {},
      //邮箱
      e_mail: 888,
      birthday: "2000-01-2",
    },
  ],
  //部门
  department: [
    {
      //部门编号
      id: 1,
      name: "销售部",
      //责任人(员工id)
      person_liable: 1,
      //上级部门
      superior_department: 1,
      remarks: "",
    },
    {
      id: 2,
      name: "销售一组",
      //责任人(员工id)
      person_liable: 2,
      //上级部门
      superior_department: 1,
      remarks: "",
    },
    {
      id: 3,
      name: "销售二组",
      //责任人(员工id)
      person_liable: 3,
      //上级部门
      superior_department: 1,
      remarks: "",
    },
  ],
  //产品
  product: [
    {
      id: 001,
      name: "",
      //单价
      unit_price: 1000,
      //规格
      specifications: "套",
      remarks: "",
    },
    {
      id: 002,
      name: "",
      //单价
      unit_price: 1500,
      //规格
      specifications: "件",
      remarks: "",
    },
    {
      id: 003,
      name: "",
      //单价
      unit_price: 1600,
      //规格
      specifications: "组",
      remarks: "",
    },
  ],
  //公告
  announcement: [
    {
      //遍历依据
      id: 0,
      //标题
      title: 1,
      //发布人
      issuer: 1,
      //发布时间
      time: 1,
      //发布内容
      content: 1,
    },
  ],
  //客户
  connection: [
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 1,
      //客户名称
      name: "企鹅企业",
      //对接人
      counterpart: "张先生",
      //客户来源
      source: "未知",
      //客户标签
      customer_label: "待开发客户",
      //客户类型
      type: "事业单位或社会团体",
      //客户所在城市
      city: "成都",
      //简介
      remarks: 1,
      //联系人
      linkman: "王先生",
      //号码
      phone_number: "17782360836"
    },
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 2,
      //客户名称
      name: "猫猫头企业",
      //对接人
      counterpart: "刘先生",
      //客户来源
      source: "客户介绍",
      //客户标签
      customer_label: "目标客户",
      //客户类型
      type: "私营企业",
      //客户所在城市
      city: "成都",
      //简介
      remarks: 1,
      //联系人
      linkman: "王先生",
      //号码
      phone_number: "17234560836"
      //
    },
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 3,
      //客户名称
      name: "小董企业",
      //对接人
      counterpart: "张先生",
      //客户来源
      source: "企业营销",
      //客户标签
      customer_label: "已开发客户",
      //客户类型
      type: "外资企业",
      //客户所在城市
      city: "成都",
      //简介
      remarks: 1,
      //联系人
      linkman: "赵先生",
      //号码
      phone_number: "18234880836"
      //
    },
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 4,
      //客户名称
      name: "小何企业",
      //对接人
      counterpart: "李先生",
      //客户来源
      source: "客户上门",
      //客户标签
      customer_label: "目标客户",
      //客户类型
      type: "外资企业",
      //客户所在城市
      city: "成都",
      //简介
      remarks: 1,
      //联系人
      linkman: "赵先生",
      //号码
      phone_number: "19834880836"
      //
    },

  ],

  //合同
  contract: [
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 1,
      //客户名称
      Client_name: "小何企业",
      //合同名称
      contract_name: "债务合同",
      //合同编号
      contract_number: "HT202005010001",
      //合同商机
      contract_opportunity: "tttttt",
      //合同金额
      contract_amount: "20000万",
      //合同状态
      contract_state: "已保存",
      //合同日期
      contract_day: "2022-11-21",
      //合同创建时间
      contract_createdDate: "2022-02-01",
      //合同内容
      contract_content: "1",
      //合同附件
      contract_fj: "",
      //创建人
      contract_Player: "1",
      //审核时间
      contract_conftime: "1",

      //回款日期
      payment_day: "2022-02-06",
      //回款期次
      payment_period: "1",
      //付款方式
      payment_method: "银行卡",
      //回款金额
      payment_amount: "11",
      //是否逾期
      isOverdue: "否",
      //银行
      bank: "中国银行",
      //账号
      account: "3456543234567",
      //逾期天数
      Overdue: "0",
      //备注
      note: "7",
    },
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 2,
      //客户名称
      Client_name: "小董企业",
      //合同名称
      contract_name: "借款合同",
      //合同编号
      contract_number: "HT202005010002",
      //合同商机
      contract_opportunity: "ttrrrr",
      //合同金额
      contract_amount: "1000",
      //合同状态 
      contract_state: "待审核",
      //合同日期
      contract_day: "2023-01-01",
      //合同创建时间
      contract_createdDate: "2023-01-03",
      //合同内容
      contract_content: "1",
      //合同附件
      contract_fj: "",
      //创建人
      contract_Player: "1",
      //审核时间
      contract_conftime: "1",

      //回款日期
      payment_day: "2022-02-06",
      //回款期次
      payment_period: "1",
      //付款方式
      payment_method: "现金",
      //回款金额
      payment_amount: "10",
      //是否逾期
      isOverdue: "否",
      //银行
      bank: "中国银行",
      //账号
      account: "3456543234567",
      //逾期天数
      Overdue: "0",
      //备注
      note: "1",
    },
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 3,
      //客户名称
      Client_name: "猫猫头企业",
      //合同名称
      contract_name: "收养合同",
      //合同编号
      contract_number: "HT202005010003",
      //合同商机
      contract_opportunity: "tter234",
      //合同金额
      contract_amount: "112340",
      //合同日期
      contract_day: "2023-02-23",
      //合同状态
      contract_state: "待审核",
      //合同创建时间
      contract_createdDate: "2023-02-01",
      //合同内容
      contract_content: "1",
      //合同附件
      contract_fj: "",
      //创建人
      contract_Player: "1",
      //审核时间
      contract_conftime: "1",

      //回款日期
      payment_day: "2022-01-23",
      //回款期次
      payment_period: "1",
      //付款方式
      payment_method: "微信",
      //回款金额
      payment_amount: "现金",
      //是否逾期
      isOverdue: "是",
      //银行
      bank: "中国银行",
      //账号
      account: "3456543234567",
      //逾期天数
      Overdue: "1",
      //备注
      note: "1",
    },
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 4,
      //客户名称
      Client_name: "企鹅企业",
      //合同名称
      contract_name: "未命名合同",
      //合同编号
      contract_number: "HT202005010004",
      //合同商机
      contract_opportunity: "tter234",
      //合同金额
      contract_amount: "112340",
      //合同状态
      contract_state: "已保存",
      //合同日期
      contract_day: "2023-02-01",
      //合同创建时间
      contract_createdDate: "2023-02-01",
      //合同内容
      contract_content: "1",
      //合同附件
      contract_fj: "",
      //创建人
      contract_Player: "1",
      //审核时间
      contract_conftime: "1",

      //回款日期
      payment_day: "2022-02-11",
      //回款期次
      payment_period: "1",
      //付款方式
      payment_method: "现金",
      //回款金额
      payment_amount: "10",
      //是否逾期
      isOverdue: "否",
      //银行
      bank: "中国银行",
      //账号
      account: "3456543234567",
      //逾期天数
      Overdue: "0",
      //备注
      note: "1",
    },
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 5,
      //客户名称
      Client_name: "大大怪企业",
      //合同名称
      contract_name: "就业合同",
      //合同编号
      contract_number: "HT202005010005",
      //合同商机
      contract_opportunity: "tter234",
      //合同金额
      contract_amount: "112340",
      //合同状态
      contract_state: "待审核",
      //合同日期
      contract_day: "2023-01-01",
      //合同创建时间
      contract_createdDate: "2023-01-01",
      //合同内容
      contract_content: "1",
      //合同附件
      contract_fj: "",
      //创建人
      contract_Player: "1",
      //审核时间
      contract_conftime: "1",

      //回款日期
      payment_day: "2022-02-01",
      //回款期次
      payment_period: "1",
      //付款方式
      payment_method: "现金",
      //回款金额
      payment_amount: "12",
      //是否逾期
      isOverdue: "是",
      //银行
      bank: "中国银行",
      //账号
      account: "3456543234567",
      //逾期天数
      Overdue: "4",
      //备注
      note: "2",
    },
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 6,
      //客户名称
      Client_name: "华城企业",
      //合同名称
      contract_name: "租赁合同",
      //合同编号
      contract_number: "HT202005010006",
      //合同商机
      contract_opportunity: "tter234",
      //合同金额
      contract_amount: "112340",
      //合同状态
      contract_state: "待审核",
      //合同日期
      contract_day: "2022-02-01",
      //合同创建时间
      contract_createdDate: "2022-03-01",
      //合同内容
      contract_content: "1",
      //合同附件
      contract_fj: "",
      //创建人
      contract_Player: "1",
      //审核时间
      contract_conftime: "1",

      //回款日期
      payment_day: "2022-02-04",
      //回款期次
      payment_period: "1",
      //付款方式
      payment_method: "支付宝",
      //回款金额
      payment_amount: "20",
      //是否逾期
      isOverdue: "否",
      //银行
      bank: "南京银行",
      //账号
      account: "3456543234567",
      //逾期天数
      Overdue: "0",
      //备注
      note: "1",
    },
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 7,
      //客户名称
      Client_name: "大大怪企业",
      //合同名称
      contract_name: "劳务合同",
      //合同编号
      contract_number: "HT202005010007",
      //合同商机
      contract_opportunity: "tter234",
      //合同金额
      contract_amount: "112340",
      //合同状态
      contract_state: "已保存",
      //合同日期
      contract_day: "2022-05-01",
      //合同创建时间
      contract_createdDate: "2022-07-07",
      //合同内容
      contract_content: "1",
      //合同附件
      contract_fj: "",
      //创建人
      contract_Player: "1",
      //审核时间
      contract_conftime: "1",

      //回款日期
      payment_day: "2022-02-08",
      //回款期次
      payment_period: "1",
      //付款方式
      payment_method: "现金",
      //回款金额
      payment_amount: "10",
      //是否逾期
      isOverdue: "是",
      //银行
      bank: "中国银行",
      //账号
      account: "3456543234567",
      //逾期天数
      Overdue: "1",
      //备注
      note: "1",
    }
  ],
};
//判定浏览器是否有缓存
if (localStorage.getItem("db")) {
  //有缓存，调用缓存
  db = JSON.parse(localStorage.getItem("db"));
} else {
  //没缓存上传数据
  localStorage.setItem("db", JSON.stringify(db));
}
function asyncLocalStory() {
  localStorage.setItem("db", JSON.stringify(db));
}
let staff = db.staff; //员工
let department = db.department; //部门
let product = db.product; //产品
let connection = db.connection; //客户
let announcement = db.announcement; //公告
let contract = db.contract; //合同

